package com.mantisframework.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * MSysUsers entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "M_SYS_USERS", catalog = "mantisframeworks")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class MSysUsers implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Column(name = "LOGIN_NAME", nullable = false, length = 50, unique = true, updatable=false)
	private String loginName;

	@Column(name = "PWD", length = 50)
	private String pwd;
	@Column(name = "USER_NAME", length = 100)
	private String userName;
	@Column(name = "NICKNAME", length = 100)
	private String nickname;
	@Column(name = "BIRTHDAY")
	@Temporal(TemporalType.DATE)
	private Date birthday;
	@Column(name = "SEX", precision = 11, columnDefinition = "default '0'")
	private Integer sex;
	@Column(name = "MOBILE_PHONE", length = 12)
	private String mobilePhone;
	@Column(name = "MOBILE_SMALL", length = 10)
	private String mobileSmall;
	@Column(name = "email", length = 100)
	private String email;
	@Column(name = "CREATE_TIME", updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;
	@Column(name = "IS_DEL", columnDefinition = "default '0'")
	private Integer isDel;
	@Column(name = "IS_LOCK", columnDefinition = "default '0'")
	private Integer isLock;
	@Column(name = "IS_ADMIN", columnDefinition = "default '0'")
	private Integer isAdmin;
	@Column(name = "IS_PUBLIC", columnDefinition = "default '0'")
	private Integer isPublic;
	@Column(name = "companyId")
	private Long companyId;
	@Column(name = "USER_ORD", columnDefinition = "default '0'")
	private Integer userOrd;
	@ManyToMany(mappedBy="users",targetEntity=MSysDepartment.class)
	private Set<MSysDepartment> depts = new HashSet<MSysDepartment>();

	// Constructors

	/** default constructor */
	public MSysUsers() {
	}

	/** minimal constructor */
	public MSysUsers(String loginName) {
		this.loginName = loginName;
	}

	/** full constructor */
	public MSysUsers(String loginName, String pwd, String userName,
			String nickname, Date birthday, Integer sex, String mobilePhone,
			String mobileSmall, Date createTime, Integer isDel, Integer isLock,
			Integer isAdmin, Integer isPublic) {
		this.loginName = loginName;
		this.pwd = pwd;
		this.userName = userName;
		this.nickname = nickname;
		this.birthday = birthday;
		this.sex = sex;
		this.mobilePhone = mobilePhone;
		this.mobileSmall = mobileSmall;
		this.createTime = createTime;
		this.isDel = isDel;
		this.isLock = isLock;
		this.isAdmin = isAdmin;
		this.isPublic = isPublic;
	}

	// Property accessors

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLoginName() {
		return this.loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getNickname() {
		return this.nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Integer getSex() {
		return this.sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public String getMobilePhone() {
		return this.mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getMobileSmall() {
		return this.mobileSmall;
	}

	public void setMobileSmall(String mobileSmall) {
		this.mobileSmall = mobileSmall;
	}

	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Integer getIsDel() {
		return this.isDel;
	}

	public void setIsDel(Integer isDel) {
		this.isDel = isDel;
	}

	public Integer getIsLock() {
		return this.isLock;
	}

	public void setIsLock(Integer isLock) {
		this.isLock = isLock;
	}

	public Integer getIsAdmin() {
		return this.isAdmin;
	}

	public void setIsAdmin(Integer isAdmin) {
		this.isAdmin = isAdmin;
	}

	public Integer getIsPublic() {
		return this.isPublic;
	}

	public void setIsPublic(Integer isPublic) {
		this.isPublic = isPublic;
	}

	/**
	 * @return companyId
	 */

	public Long getCompanyId() {
		return companyId;
	}

	/**
	 * @param companyId
	 *            要设置的 companyId
	 */

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	/**
	 * @return userOrd
	 */

	public Integer getUserOrd() {
		return userOrd;
	}

	/**
	 * @param userOrd
	 *            要设置的 userOrd
	 */

	public void setUserOrd(Integer userOrd) {
		this.userOrd = userOrd;
	}

	/**
	 * @return email
	 */

	public String getEmail() {
		return email;
	}

	/**
	 * @param email
	 *            要设置的 email
	 */

	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return depts
	 */
	
	public Set<MSysDepartment> getDepts() {
		return depts;
	}

	/**
	 * @param depts 要设置的 depts
	 */
	
	public void setDepts(Set<MSysDepartment> depts) {
		this.depts = depts;
	}

}